<?php
header ("Content-Type:text/html; charset= utf-8");
require_once ('config.php');
require_once (WEBURL.'/include/conn.php');
require_once (WEBURL.'/login_status_check.php');

if(empty($_GET['channel_id'])){
	echo "forbidden!";
	exit();
}
$channel_id=$_GET['channel_id'];
$pre_id=$_GET['pre_id'];
$channel_name=$_GET['channel_name'];
if(!checkLogin()){
	$gotopage=base64_encode("channel_remove.php?channel_id=$channel_id&pre_id=$pre_id&channel_name=$channel_name");
	header("Location:admin_login.php?gotopage=".$gotopage);
}
else{
	require_once (WEBURL.'/channel.class.php');

	$smarty->assign("channel_id",$channel_id);
	$smarty->assign("pre_id",$pre_id);
	$smarty->assign("channel_name",$channel_name);

	$sql_get_child_channel_num="select * from channel where pre_id=$pre_id";
	$result_get_child_channel_num=mysql_query($sql_get_child_channel_num);
	$child_channel_num=mysql_num_rows($result_get_child_channel_num);
	$smarty->assign("child_channel_num",$child_channel_num);
	
	$smarty->assign("title","栏目删除确认");
	$channel= new Channel();
	$channel_articles_number=$channel->getArticleNumber($channel_id);
	if($channel_articles_number==0){
		$whether_channel_has_articles=0;
	}else{
		$whether_channel_has_articles=1;
	}
	$smarty->assign("whether_channel_has_articles","$whether_channel_has_articles");

	$channelt=new Channel();
	$all_article_channel=$channel->getAllChannel("article");
	$smarty->assign("all_article_channel",$all_article_channel);
	$smarty->display("channel_remove.htm");
}

